{% extends "base/base.html" %}

{% block title %}{{ object.artist }} - {{ object.title }}{% endblock %} 
 
{% block main %}

{% load dv_extend %}<h2>
 <img class="icon_header" src="{{ MEDIA_URL }}music.png" alt="" />Song Information
{% if user.is_staff %}
 [<a href="/admin/webview/song/{{ object.id }}/">Edit Info</a>] <em>Admin Preview:</em> {% with object as song %}{% include "webview/t/flash_playsong.html" %}{% endwith %}
{% endif %}
</h2>

{% with object as song %}{% include "webview/t/songname.html" %}{% endwith %}
 
<p>
Author: 
{% for artist in object.artists.all %}
 {% with artist as A%}{% include "webview/t/artist.html" %}{% endwith %}{% if forloop.last %} {% else %}, {% endif %} 
{% endfor %}
{% for group in object.groups.all %}
 {% with group as G%}{% include "webview/t/group.html" %}{% endwith %} 
{% endfor %}
</p>

{% ifnotequal object.labels.count 0 %}
 Production Label: {% for label in object.labels.all %}{% with label as L %}{% include "webview/t/label.html" %}{% endwith %}{% if forloop.last %} {% else %}, {% endif %}{% endfor %}<br />
{% endifnotequal %}

{% if object.uploader %}
Uploaded By: {% with object.uploader as U%}{% include "webview/t/user.html" %}{% endwith %}
{% endif %}

<p>
 Last Queued : 
 {% ifnotequal object.last_queued "Never" %}
  {{ object.last_queued|timesince }} ago
 {% else %}
  Never Been Queued!
 {% endifnotequal %}
</p>

Extra Resources:
{% with object as S %}{% include "webview/t/song-icons.html" %}{% endwith %}
<br />

<p>
Song Length: {{ object.length }}<br />
{% if object.release_year %}Release Year: {{ object.release_year }}<br />{% endif %}
Song Status: {{ object.get_status_display }}
{% if object.bitrate %}<br />Song Bitrate: {{ object.bitrate }} kbps{% endif %}
{% if object.type %}<br />Song Source: {{ object.type }}{% endif %}
{% if object.platform %}<br />Song Platform: {% with object.platform as P %}{% include "webview/t/platformname.html" %}{% endwith %}{% endif %}
</p>

{% if object.info %}
<br />Additional Information:<br /><i>{{ object.info|urlize|bbcode|linebreaks }}</i>
{% endif %}

{% load dv_extend %}{% load cache %}

{% if user.is_authenticated %}
 {% is_favorite object user %}
  <p>
 {% if object.is_locked %}
  <img class="song_head" src="/static/lock.png" title="Song Locked" /> <i>Song is currently locked for queuing. It will be available for request in {{ object.locked_until|timeuntil }}</i>
 {% else %}
  <img class="song_head" src="{{ MEDIA_URL }}add.png" title="Add To Queue!" /> <a href="{{ object.get_absolute_url }}queue/">Add To Queue</a>
 {% endif %}<br />
 {% if is_favorite %}
  <img class="song_head" src="{{ MEDIA_URL }}heart.png" title="Already Loved!" /> Already In Your Favourites List!
 {% else %}
  <img class="song_head" src="{{ MEDIA_URL }}heart_add.png" title="Add To Faves" /> <a href="{% url dv-add_fav object.id %}/">Add To Favorites</a>
 {% endif %}
 </p>
{% endif %}

<p>
This song has been played {{ object.times_played }} times. [<a href="{{object.get_absolute_url}}queue_history">See Request History</a>]<br />
It was added {{ object.added|timesince }} ago.
</p>
{% cache 86400 object.title object.pouetid %}
 {% if object.pouetid %}
  {{ object.get_pouet_screenshot }}
  {{ object.get_pouet_download }}
 {% endif %}
{% endcache %}

{% if object.songdownload_set.all  %}
 <h2>Download Links</h2>
 <ul>
 {% for dl in object.songdownload_set.all %}
  <li><a href="{{ dl.download_url }}">{{ dl.title }}</a></li>
 {% endfor %}
 </ul>
{% endif %}

<h2><img class="icon_header" src="{{ MEDIA_URL }}star.png" alt="" />Song Rating</h2>
{% if object.rating_votes %}
  Song Rating: {{ object.rating|floatformat }} - Votes Placed: {{ object.rating_votes }} <a href="{{ object.get_absolute_url }}votes/">View Voting History</a><br />
{% else %}
 No Votes Yet :( <br />
{% endif %}

{% if user.is_authenticated %}
 {% get_vote object user %}
 Your Vote : {{ vote_value|default:"You have not voted yet!!" }} <br/>
  <form action="{% url dv-vote object.id %}" method="post">
 {% for v in vote_range %}
   <input type="radio" name="Rating" value="{{ v }}" {% ifequal vote_value v %}checked{% endifequal %} />{{ v }}
 {% endfor %}
  <input type="submit" /> 
  </form> 
{% endif %}

A total of {{ object.num_favorited }} users have this song on their favourites list.<br />

<h2><img class="icon_header" src="{{ MEDIA_URL }}music.png" alt="" />Compilation / Remix Information</h2>
{% if object.remix_of_id %}This song is a remix of: {% get_song_queuetag object.remix_of_id %}<br />{% endif %}
{% ifnotequal comps.count 0 %}
 <p><strong>This Song Is Listed In The Following Compilations:</strong><br /><br />
 {% for comp in comps.all %}{% with comp as C %}{% include "webview/t/compilation.html" %}{% endwith %}<br />{% endfor %}
 </p>
{% endifnotequal %}

{% ifnotequal remix.count 0 %}
<br /><strong>Remixes Based On This Song:</strong><br /><br />
{% for mix in remix.all %}{% get_song_queuetag mix.id %}<br />{% endfor %}
{% endifnotequal %}

<h2>
<img class="icon_header" src="{{ MEDIA_URL }}comment.png" alt="" />User Comments
</h2>

<p>
 Displaying Last 5 User Comments.
 There are a total of {{ object.songcomment_set.all|length }} comments for this song.
 <a href="{% url dv-song_comment object.id %}">See All Comments For This Song</a>
</p>

<table id="djangoForumThreadPosts">
 <tr>
  <th>User</th>
  <th>Song Comment</th>
 </tr>
 {% for comment in object.songcomment_set.all|slice:":5" %}
 {% include "webview/t/song_comment.html" %}
 {% endfor %}
</table>

{% if user.is_authenticated %}
 Add New Song Comment :<br />
 <form action="{% url dv-addcomment object.id %}" method="post">
  <textarea name="Comment" rows='8' cols='50' class="input"></textarea><br />
  <input type="submit" value="Add New Comment" />
 </form>
{% endif %}

{% endblock %}
